<template>
  <div id="app">
    <el-container>
      <!-- 顶部导航栏 -->
      <el-header class="header">
        <div class="nav-container">
          <div class="logo">
            <h2>胡启行的个人简历</h2>
          </div>
          <el-menu
            :default-active="$route.path"
            mode="horizontal"
            router
            class="nav-menu"
            background-color="#ffffff"
            text-color="#409EFF"
            active-text-color="#1890ff"
          >
            <el-menu-item index="/">首页</el-menu-item>
            <el-menu-item index="/education">教育背景</el-menu-item>
            <el-menu-item index="/projects">项目经历</el-menu-item>
            <el-menu-item index="/internship">实习经历</el-menu-item>
            <el-menu-item index="/certificates">竞赛证书</el-menu-item>
            <el-menu-item index="/about">关于我</el-menu-item>
          </el-menu>
        </div>
      </el-header>

      <!-- 主要内容区域 -->
      <el-main class="main-content">
        <router-view />
      </el-main>

      <!-- 底部 -->
      <el-footer class="footer">
        <div class="footer-content">
          <p>&copy; 2024 胡启行. All rights reserved.</p>
          <div class="contact-links">
            <el-link href="mailto:hx34879@163.com" type="primary">
              <el-icon><Message /></el-icon>
              hx34879@163.com
            </el-link>
            <el-link
              href="https://gitee.com/litinyana"
              target="_blank"
              type="primary"
            >
              <el-icon><Link /></el-icon>
              Gitee
            </el-link>
          </div>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script setup>
import { createRouter, createWebHistory } from "vue-router";
import { createApp } from "vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

// 首页组件
const Home = {
  template: `
    <div class="page-container">
      <div class="hero-section">
        <el-row :gutter="20" justify="center">
          <el-col :xs="24" :sm="20" :md="16" :lg="12">
            <el-card class="hero-card" shadow="hover">
              <div class="hero-content">
                <el-avatar :size="120" class="avatar">
                  <el-icon size="60"><User /></el-icon>
                </el-avatar>
                <h1 class="name">胡启行</h1>
                <p class="title">大三学生 | 全栈开发者</p>
                <div class="contact-info">
                  <el-tag type="primary" size="large">
                    <el-icon><Message /></el-icon>
                    hx34879@163.com
                  </el-tag>
                  <el-tag type="success" size="large">
                    <el-icon><Link /></el-icon>
                    Gitee: litinyana
                  </el-tag>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </div>

      <div class="advantages-section">
        <h2 class="section-title">个人优势</h2>
        <el-row :gutter="20">
          <el-col :xs="24" :sm="12" :md="8" v-for="advantage in advantages" :key="advantage.title">
            <el-card class="advantage-card" shadow="hover">
              <div class="advantage-content">
                <el-icon :size="40" class="advantage-icon">
                  <component :is="advantage.icon" />
                </el-icon>
                <h3>{{ advantage.title }}</h3>
                <p>{{ advantage.description }}</p>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </div>
  `,
  setup() {
    const advantages = [
      {
        title: "技术热情",
        description: "对前端技术充满热情，持续学习新技术和框架",
        icon: "Star",
      },
      {
        title: "项目经验",
        description: "具有多个完整项目开发经验，涵盖前后端技术",
        icon: "Trophy",
      },
      {
        title: "学习能力",
        description: "快速学习新技术，适应不同的开发环境和需求",
        icon: "Reading",
      },
    ];
    return { advantages };
  },
};

// 教育背景组件
const Education = {
  template: `
    <div class="page-container">
      <h2 class="page-title">教育背景</h2>
      <el-row justify="center">
        <el-col :xs="24" :sm="20" :md="16">
          <el-timeline>
            <el-timeline-item timestamp="2023 - 至今" placement="top">
              <el-card shadow="hover">
                <h3>大学在读</h3>
                <p class="education-status">大三学生</p>
                <p class="education-desc">专业课程学习优秀，积极参与各类技术竞赛和项目实践</p>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </el-col>
      </el-row>
    </div>
  `,
};

// 项目经历组件
const Projects = {
  template: `
    <div class="page-container">
      <h2 class="page-title">项目经历</h2>
      <el-row :gutter="20">
        <el-col :xs="24" :md="12" v-for="project in projects" :key="project.name">
          <el-card class="project-card" shadow="hover">
            <template #header>
              <div class="project-header">
                <h3>{{ project.name }}</h3>
                <el-tag :type="project.status === '已完成' ? 'success' : 'warning'">
                  {{ project.status }}
                </el-tag>
              </div>
            </template>
            <div class="project-content">
              <p class="project-desc">{{ project.description }}</p>
              <div class="tech-stack">
                <h4>技术栈：</h4>
                <el-tag 
                  v-for="tech in project.technologies" 
                  :key="tech" 
                  size="small" 
                  class="tech-tag"
                >
                  {{ tech }}
                </el-tag>
              </div>
              <div class="project-features">
                <h4>主要功能：</h4>
                <ul>
                  <li v-for="feature in project.features" :key="feature">{{ feature }}</li>
                </ul>
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  `,
  setup() {
    const projects = [
      {
        name: "用户管理系统",
        status: "已完成",
        description:
          "基于Vue.js和Spring Boot开发的用户管理系统，实现了完整的用户CRUD操作和权限管理功能。",
        technologies: [
          "Vue.js",
          "Spring Boot",
          "MySQL",
          "Element UI",
          "MyBatis",
        ],
        features: [
          "用户注册、登录、注销功能",
          "用户信息的增删改查",
          "角色权限管理",
          "数据分页和搜索",
          "响应式界面设计",
        ],
      },
      {
        name: "外卖点餐系统",
        status: "已完成",
        description:
          "模拟外卖平台的点餐系统，包含商家管理、菜品展示、订单处理等完整业务流程。",
        technologies: [
          "Vue.js",
          "Node.js",
          "Express",
          "MongoDB",
          "Element Plus",
        ],
        features: [
          "商家和菜品信息展示",
          "购物车功能",
          "订单生成和管理",
          "用户评价系统",
          "移动端适配",
        ],
      },
    ];
    return { projects };
  },
};

// 实习经历组件
const Internship = {
  template: `
    <div class="page-container">
      <h2 class="page-title">实习经历</h2>
      <el-row justify="center">
        <el-col :xs="24" :sm="20" :md="16">
          <el-timeline>
            <el-timeline-item 
              v-for="experience in experiences" 
              :key="experience.company"
              :timestamp="experience.period" 
              placement="top"
            >
              <el-card shadow="hover">
                <h3>{{ experience.position }}</h3>
                <h4 class="company">{{ experience.company }}</h4>
                <p class="experience-desc">{{ experience.description }}</p>
                <div class="achievements">
                  <h4>主要成果：</h4>
                  <ul>
                    <li v-for="achievement in experience.achievements" :key="achievement">
                      {{ achievement }}
                    </li>
                  </ul>
                </div>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </el-col>
      </el-row>
    </div>
  `,
  setup() {
    const experiences = [
      {
        company: "科技公司实习",
        position: "前端开发实习生",
        period: "2023年暑期",
        description: "参与公司前端项目开发，负责页面组件开发和优化工作。",
        achievements: [
          "独立完成3个页面组件的开发",
          "优化页面加载速度20%",
          "学习并应用了最新的前端技术栈",
          "与团队协作完成项目迭代",
        ],
      },
    ];
    return { experiences };
  },
};

// 竞赛证书组件
const Certificates = {
  template: `
    <div class="page-container">
      <h2 class="page-title">竞赛证书</h2>
      <el-row :gutter="20">
        <el-col :xs="24" :sm="12" :md="8" v-for="cert in certificates" :key="cert.name">
          <el-card class="cert-card" shadow="hover">
            <div class="cert-content">
              <el-icon :size="50" class="cert-icon" :style="{color: cert.color}">
                <Trophy />
              </el-icon>
              <h3>{{ cert.name }}</h3>
              <p class="cert-level">{{ cert.level }}</p>
              <p class="cert-time">{{ cert.time }}</p>
              <p class="cert-desc">{{ cert.description }}</p>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  `,
  setup() {
    const certificates = [
      {
        name: "程序设计竞赛",
        level: "省级三等奖",
        time: "2023年",
        description: "在省级程序设计竞赛中获得三等奖，展现了扎实的编程基础。",
        color: "#f56c6c",
      },
      {
        name: "创新创业大赛",
        level: "校级三等奖",
        time: "2023年",
        description: "参与创新创业项目，获得校级三等奖，体现了创新思维能力。",
        color: "#409EFF",
      },
      {
        name: "技术技能认证",
        level: "前端开发",
        time: "2024年",
        description: "通过前端开发技能认证，掌握现代前端开发技术。",
        color: "#67C23A",
      },
    ];
    return { certificates };
  },
};

// 关于我组件
const About = {
  template: `
    <div class="page-container">
      <h2 class="page-title">关于我</h2>
      <el-row :gutter="20">
        <el-col :xs="24" :md="12">
          <el-card class="about-card" shadow="hover">
            <template #header>
              <h3>自我评价</h3>
            </template>
            <div class="self-evaluation">
              <p>我是一名充满热情的大三学生，对前端开发技术有着浓厚的兴趣。在学习过程中，我始终保持着积极主动的态度，不断探索新技术，提升自己的技能水平。</p>
              <p>我具备良好的学习能力和团队协作精神，能够快速适应新环境和新技术。通过多个项目的实践，我积累了丰富的开发经验，并在各类竞赛中取得了不错的成绩。</p>
              <p>未来，我希望能够在前端开发领域继续深耕，成为一名优秀的全栈开发工程师。</p>
            </div>
          </el-card>
        </el-col>
        <el-col :xs="24" :md="12">
          <el-card class="skills-card" shadow="hover">
            <template #header>
              <h3>技术技能</h3>
            </template>
            <div class="skills-content">
              <div v-for="category in skillCategories" :key="category.name" class="skill-category">
                <h4>{{ category.name }}</h4>
                <div class="skills-tags">
                  <el-tag 
                    v-for="skill in category.skills" 
                    :key="skill.name"
                    :type="skill.level === '熟练' ? 'success' : skill.level === '了解' ? 'info' : 'primary'"
                    class="skill-tag"
                  >
                    {{ skill.name }} ({{ skill.level }})
                  </el-tag>
                </div>
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  `,
  setup() {
    const skillCategories = [
      {
        name: "前端技术",
        skills: [
          { name: "HTML/CSS", level: "熟练" },
          { name: "JavaScript", level: "熟练" },
          { name: "Vue.js", level: "熟练" },
          { name: "React", level: "了解" },
          { name: "TypeScript", level: "了解" },
        ],
      },
      {
        name: "后端技术",
        skills: [
          { name: "Java", level: "熟练" },
          { name: "Spring Boot", level: "熟练" },
          { name: "Node.js", level: "了解" },
          { name: "MySQL", level: "熟练" },
          { name: "MongoDB", level: "了解" },
        ],
      },
      {
        name: "开发工具",
        skills: [
          { name: "Git", level: "熟练" },
          { name: "VS Code", level: "熟练" },
          { name: "IntelliJ IDEA", level: "熟练" },
          { name: "Postman", level: "熟练" },
        ],
      },
    ];
    return { skillCategories };
  },
};

// 路由配置
const routes = [
  { path: "/", component: Home },
  { path: "/education", component: Education },
  { path: "/projects", component: Projects },
  { path: "/internship", component: Internship },
  { path: "/certificates", component: Certificates },
  { path: "/about", component: About },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

// 创建应用实例
const app = createApp({});
app.use(ElementPlus);
app.use(router);

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
</script>

<style scoped>
/* 全局样式 */
#app {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

/* 头部样式 */
.header {
  background: #ffffff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 20px;
}

.logo h2 {
  color: #409eff;
  margin: 0;
  font-size: 20px;
}

.nav-menu {
  border: none;
}

/* 主要内容区域 */
.main-content {
  margin-top: 60px;
  padding: 40px 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* 页面容器 */
.page-container {
  max-width: 100%;
}

.page-title {
  text-align: center;
  color: #409eff;
  margin-bottom: 40px;
  font-size: 32px;
  font-weight: 600;
}

/* 首页样式 */
.hero-section {
  margin-bottom: 60px;
}

.hero-card {
  text-align: center;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.hero-content {
  padding: 40px 20px;
}

.avatar {
  background: linear-gradient(135deg, #409eff, #1890ff);
  margin-bottom: 20px;
}

.name {
  font-size: 36px;
  color: #409eff;
  margin: 20px 0 10px 0;
  font-weight: 600;
}

.title {
  font-size: 18px;
  color: #666;
  margin-bottom: 30px;
}

.contact-info {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.contact-info .el-tag {
  padding: 8px 16px;
  font-size: 14px;
}

/* 优势卡片 */
.advantages-section {
  margin-top: 60px;
}

.section-title {
  text-align: center;
  color: #409eff;
  margin-bottom: 40px;
  font-size: 28px;
  font-weight: 600;
}

.advantage-card {
  height: 100%;
  transition: transform 0.3s ease;
  border: none;
  background: rgba(255, 255, 255, 0.9);
}

.advantage-card:hover {
  transform: translateY(-5px);
}

.advantage-content {
  text-align: center;
  padding: 20px;
}

.advantage-icon {
  color: #409eff;
  margin-bottom: 15px;
}

.advantage-content h3 {
  color: #409eff;
  margin: 15px 0;
  font-size: 20px;
}

.advantage-content p {
  color: #666;
  line-height: 1.6;
}

/* 项目卡片 */
.project-card {
  height: 100%;
  margin-bottom: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-header h3 {
  color: #409eff;
  margin: 0;
  font-size: 20px;
}

.project-content {
  padding: 10px 0;
}

.project-desc {
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.tech-stack,
.project-features {
  margin-bottom: 15px;
}

.tech-stack h4,
.project-features h4 {
  color: #409eff;
  margin-bottom: 10px;
  font-size: 16px;
}

.tech-tag {
  margin-right: 8px;
  margin-bottom: 5px;
}

.project-features ul {
  margin: 0;
  padding-left: 20px;
}

.project-features li {
  color: #666;
  line-height: 1.8;
}

/* 教育背景和实习经历 */
.education-status {
  font-size: 18px;
  color: #409eff;
  font-weight: 600;
  margin: 10px 0;
}

.education-desc,
.experience-desc {
  color: #666;
  line-height: 1.6;
  margin: 15px 0;
}

.company {
  color: #409eff;
  margin: 10px 0;
  font-size: 16px;
}

.achievements h4 {
  color: #409eff;
  margin: 15px 0 10px 0;
}

.achievements ul {
  margin: 0;
  padding-left: 20px;
}

.achievements li {
  color: #666;
  line-height: 1.8;
}

/* 证书卡片 */
.cert-card {
  height: 100%;
  text-align: center;
  margin-bottom: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  transition: transform 0.3s ease;
}

.cert-card:hover {
  transform: translateY(-5px);
}

.cert-content {
  padding: 20px;
}

.cert-icon {
  margin-bottom: 15px;
}

.cert-content h3 {
  color: #409eff;
  margin: 15px 0;
  font-size: 18px;
}

.cert-level {
  font-size: 16px;
  color: #e6a23c;
  font-weight: 600;
  margin: 10px 0;
}

.cert-time {
  color: #909399;
  margin: 10px 0;
}

.cert-desc {
  color: #666;
  line-height: 1.6;
}

/* 关于我页面 */
.about-card,
.skills-card {
  height: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
}

.self-evaluation p {
  color: #666;
  line-height: 1.8;
  margin-bottom: 15px;
  text-indent: 2em;
}

.skills-content {
  padding: 10px 0;
}

.skill-category {
  margin-bottom: 25px;
}

.skill-category h4 {
  color: #409eff;
  margin-bottom: 15px;
  font-size: 16px;
  border-left: 3px solid #409eff;
  padding-left: 10px;
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  margin: 0;
}

/* 底部样式 */
.footer {
  background: #ffffff;
  border-top: 1px solid #e4e7ed;
  margin-top: 60px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-content p {
  color: #666;
  margin: 0;
}

.contact-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.contact-links .el-link {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 10px 20px;
  }

  .logo {
    margin-bottom: 10px;
  }

  .logo h2 {
    font-size: 18px;
  }

  .main-content {
    margin-top: 100px;
    padding: 20px 10px;
  }

  .page-title {
    font-size: 24px;
    margin-bottom: 30px;
  }

  .name {
    font-size: 28px;
  }

  .contact-info {
    flex-direction: column;
    align-items: center;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .contact-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero-content {
    padding: 20px 10px;
  }

  .advantage-content,
  .cert-content {
    padding: 15px;
  }

  .project-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
</style>
